<extend name="Public/base"/>
<block name="body">
    <div class="portlet box blue">
        <div class="portlet-title">
            <div class="caption"><i class="fa fa-reorder"></i>添加班级</div>
            <div class="tools">
                <a href="" class="collapse"></a><a href="" class="remove"></a>
            </div>
        </div>
        <div class="portlet-body form">
            <form class="class-form" action="{:U('')}" method="post">
                <div class="form-body">
                    <div class="form-group">
                        <label>班级名称</label>
                        <input type="text" name="grade_name" class="form-control input-xlarge" placeholder="请输入班级名称">
                    </div>
                </div>
                <div class="form-body">
                    <div class="form-group">
                        <label>班级号</label>
                        <input type="number" name="class_number" class="form-control input-xlarge" placeholder="请输入班级号">
                    </div>
                </div>
                <if condition="$_GET['gid'] eq null">
                    <div class="form-body">
                        <div class="form-group">
                            <label>所在年级</label>
                            <select name="uid" name="gid" class="form-control input-xlarge">
                                <option value="">请选择</option>
                                <volist name="grade_data" id="vo">
                                    <option value="{$vo.gid}">{$vo.class_name}</option>
                                </volist>
                            </select>
                        </div>
                    </div>
                    <else/>
                    <input type="hidden" name="gid" value="{$_GET['gid']}"/>
                </if>
                <div class="form-body">
                    <div class="form-group">
                        <label>负责人</label>
                        <select name="uid" onchange="fun_prin(this)" name="uid" class="form-control input-xlarge">
                            <option value="">请选择</option>
                            <volist name="_list" id="vo">
                                <option value="{$vo.uid}">{$vo.nickname}</option>
                            </volist>
                        </select>
                    </div>
                </div>
                <div class="form-body">
                    <div class="form-group">
                        <label>可容纳人数</label>
                        <input type="text" name="number_people" class="form-control input-xlarge" placeholder="请输入可容纳人数">
                    </div>
                </div>


                <input type="hidden" value="" name="principal" />
                <div class="form-actions fluid">
                    <div class="col-md-offset-4 col-md-8">
                        <button type="submit" target-form="class-form" class="ajax-post btn green">确定</button>
                        <button type="button" onclick="javascript:history.back(-1);return false;" class="btn default">返回</button>
                    </div>
                </div>
            </form>
        </div>
    </div>

</block>

<block name="script">
    <script src="__STATIC__/scripts/app.js"></script>
    <script>
        jQuery(document).ready(function() {
            App.init();
            highlight_subnav('{:U('User/classAndGrade')}');

        });

        function fun_prin(that){
            var nickname= $(that).find("option:selected").text();
            $("[name='principal']").val(nickname)
        }
    </script>
</block>